package com.ddd.demo.lee.test;

public class Solution9 {

    public static boolean isPalindrome3(int x) {
        if(x < 0 || (x % 10 == 0 && x != 0)){
            return false;
        }

        int r = 0;
        while (x > r){

        }

        return true;
    }


    public static boolean isPalindrome2(int x) {
        String s = x + "";
        StringBuilder sb = new StringBuilder(s);
        return s.equals(sb.reverse()+"");
    }

    public static boolean isPalindrome(int x) {
        boolean f = true;
        String s = x + "";
        char[] chars = s.toCharArray();
        for (int i = 0; i < chars.length; i++) {
            if(chars[i] != chars[chars.length -1 - i]){
                return false;
            }
        }
        return f;
    }

    public static void main(String[] args) {
        int x = 1212;
        boolean palindrome = isPalindrome2(x);
        System.out.println("palindrome = " + palindrome);
    }
}
